<template>
  <!-- 修正容器嵌套结构 -->
  <el-container class="layout-container">
    <el-aside class="sidebar-container">
      <Sidebar :isCollapse="isCollapse" />
    </el-aside>

    <el-container direction="vertical">
      <el-header class="header-container">
        <Header :collapse="isCollapse" @toggle-collapse="toggleCollapse" />
      </el-header>

      <el-main class="main-container">
        <!-- 原有keep-alive部分保持不变 -->
      </el-main>
    </el-container>
  </el-container>
</template>

<style lang="scss" scoped>
.layout-container {
  height: 100vh;
  display: flex;
  
  // 修正侧边栏样式
  .sidebar-container {
    width: auto !important; // 移除固定宽度
    height: 100vh;
    background: #001529;
    transition: width 0.3s;
  }

  // 修正头部样式
  .header-container {
    height: 60px;
    padding: 0 20px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
  }

  // 修正内容区域样式
  .main-container {
    height: calc(100vh - 60px);
    padding: 20px;
    overflow-y: auto; // 添加滚动条
    background: #f0f2f5;
  }

  @media (max-width: 768px) {
    // 移动端布局优化
    flex-direction: column;
    
    .sidebar-container {
      width: 100% !important;
      height: auto;
    }
    
    .main-container {
      height: calc(100vh - 120px); // 调整移动端高度
    }
  }
}
</style>